/*
 * MainApplet.java
 *
 * Created on 11. Oktober 2008, 13:48
 */
package de.ctnetzapplet.view;

import de.ctnetzapplet.controller.MainAppletController;

import java.awt.Color;

import java.awt.EventQueue;
import java.util.Calendar;
import javax.swing.DefaultComboBoxModel;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

/**
 * 
 * @author alex
 */
public class MainApplet extends javax.swing.JApplet {

    /**
     *
     */
    private static final long serialVersionUID = 1L;

    /** Initializes the applet MainApplet */
    @Override
    public void init() {
        try {
            java.awt.EventQueue.invokeLater(new Runnable() {

                public void run() {
                    initComponents();
                    initCustom();
                }
            });
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }

    /**
     * used for custom initialization
     */
    private void initCustom() {
        try {
            UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
        } catch (Exception e) {
        }
        SwingUtilities.updateComponentTreeUI(this);

        new MainAppletController(this);
    }

    /**
     * appends a message to the statusbox in the applet.
     * @param msg
     * 			message to append
     */
    public void appendMessage(final String msg) {
        Calendar now = Calendar.getInstance();
        String b = "" + now.get(Calendar.HOUR_OF_DAY);// now.getHours();
        if (b.length() == 1) {
            b = "0" + b;
        }
        statusMessages.append("[" + b);
        b = "" + now.get(Calendar.MINUTE); // getMinutes();
        if (b.length() == 1) {
            b = "0" + b;
        }
        statusMessages.append(":" + b);
        b = "" + now.get(Calendar.SECOND); // getSeconds();
        if (b.length() == 1) {
            b = "0" + b;
        }
        statusMessages.append(":" + b + "] " + msg + "\n");
    }

    /**
     * This method is called from within the init() method to initialize the
     * form. WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        labelIP = new javax.swing.JLabel();
        txtPort = new javax.swing.JTextField();
        btnUpdateSettings = new javax.swing.JButton();
        labelPort = new javax.swing.JLabel();
        txtIP = new javax.swing.JTextField();
        jPanel5 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        statusMessages = new javax.swing.JTextArea();
        jPanel8 = new javax.swing.JPanel();
        jPanel7 = new javax.swing.JPanel();
        btnDeleteTimer = new javax.swing.JButton();
        btnWriteTimer = new javax.swing.JButton();
        btnSetDateTime = new javax.swing.JButton();
        btnReadTimer = new javax.swing.JButton();
        jPanel6 = new javax.swing.JPanel();
        jLabel10 = new javax.swing.JLabel();
        jScrollPane4 = new javax.swing.JScrollPane();
        timer_weekday = new javax.swing.JList();
        jLabel8 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        timer_poweronoff = new javax.swing.JList();
        jLabel9 = new javax.swing.JLabel();
        jScrollPane3 = new javax.swing.JScrollPane();
        timer_relais = new javax.swing.JList();
        jPanel4 = new javax.swing.JPanel();
        timer_nr = new javax.swing.JComboBox();
        timer_day = new javax.swing.JComboBox();
        jLabel6 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        timer_minute = new javax.swing.JComboBox();
        timer_month = new javax.swing.JComboBox();
        jLabel7 = new javax.swing.JLabel();
        timer_hour = new javax.swing.JComboBox();
        timer_second = new javax.swing.JComboBox();
        timer_year = new javax.swing.JComboBox();
        timer_getDateTime = new javax.swing.JCheckBox();
        jLabel4 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        btnRelais1 = new javax.swing.JButton();
        btnRelais2 = new javax.swing.JButton();
        btnRelais3 = new javax.swing.JButton();
        btnRelaisAux = new javax.swing.JButton();
        btnReadRelais = new javax.swing.JButton();
        jLabel3 = new javax.swing.JLabel();
        btnRelais5 = new javax.swing.JButton();
        btnRelais6 = new javax.swing.JButton();
        btnRelais4 = new javax.swing.JButton();
        autoUpdate = new javax.swing.JCheckBox();

        setName("Form"); // NOI18N
        setStub(null);
        getContentPane().setLayout(new javax.swing.BoxLayout(getContentPane(), javax.swing.BoxLayout.LINE_AXIS));

        jPanel1.setName("jPanel1"); // NOI18N

        jLabel1.setFont(new java.awt.Font("Tahoma", 1, 18)); // NOI18N
        jLabel1.setText("c't Netzschalter");
        jLabel1.setName("jLabel1"); // NOI18N

        jPanel3.setName("jPanel3"); // NOI18N

        jLabel2.setText("Connection Settings");
        jLabel2.setName("jLabel2"); // NOI18N

        labelIP.setLabelFor(txtIP);
        labelIP.setText("IP");
        labelIP.setName("labelIP"); // NOI18N

        txtPort.setText("10001");
        txtPort.setName("txtPort"); // NOI18N

        btnUpdateSettings.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        btnUpdateSettings.setText("Update");
        btnUpdateSettings.setMaximumSize(new java.awt.Dimension(76, 23));
        btnUpdateSettings.setMinimumSize(new java.awt.Dimension(76, 23));
        btnUpdateSettings.setName("btnUpdateSettings"); // NOI18N
        btnUpdateSettings.setPreferredSize(new java.awt.Dimension(76, 23));

        labelPort.setText("Port");
        labelPort.setName("labelPort"); // NOI18N

        txtIP.setText("192.168.6.3");
        txtIP.setName("txtIP"); // NOI18N

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jLabel2)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addComponent(labelIP, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtIP, javax.swing.GroupLayout.PREFERRED_SIZE, 223, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(labelPort, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtPort, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addComponent(btnUpdateSettings, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(63, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelIP)
                    .addComponent(txtIP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelPort)
                    .addComponent(txtPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnUpdateSettings, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel5.setName("jPanel5"); // NOI18N

        jScrollPane1.setName("jScrollPane1"); // NOI18N

        statusMessages.setColumns(20);
        statusMessages.setFont(statusMessages.getFont().deriveFont(statusMessages.getFont().getSize()-2f));
        statusMessages.setRows(5);
        statusMessages.setName("statusMessages"); // NOI18N
        jScrollPane1.setViewportView(statusMessages);

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 482, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jPanel8.setName("jPanel8"); // NOI18N

        jPanel7.setName("jPanel7"); // NOI18N

        btnDeleteTimer.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        btnDeleteTimer.setText("Delete Timer");
        btnDeleteTimer.setEnabled(false);
        btnDeleteTimer.setMaximumSize(new java.awt.Dimension(117, 23));
        btnDeleteTimer.setMinimumSize(new java.awt.Dimension(117, 23));
        btnDeleteTimer.setName("btnDeleteTimer"); // NOI18N
        btnDeleteTimer.setPreferredSize(new java.awt.Dimension(117, 23));

        btnWriteTimer.setFont(new java.awt.Font("Tahoma", 1, 11));
        btnWriteTimer.setText("Write Timer");
        btnWriteTimer.setEnabled(false);
        btnWriteTimer.setMaximumSize(new java.awt.Dimension(117, 23));
        btnWriteTimer.setMinimumSize(new java.awt.Dimension(117, 23));
        btnWriteTimer.setName("btnWriteTimer"); // NOI18N
        btnWriteTimer.setPreferredSize(new java.awt.Dimension(117, 23));

        btnSetDateTime.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        btnSetDateTime.setText("Set Date/Time");
        btnSetDateTime.setMaximumSize(new java.awt.Dimension(117, 23));
        btnSetDateTime.setMinimumSize(new java.awt.Dimension(117, 23));
        btnSetDateTime.setName("btnSetDateTime"); // NOI18N
        btnSetDateTime.setPreferredSize(new java.awt.Dimension(117, 23));

        btnReadTimer.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        btnReadTimer.setText("Read Timer");
        btnReadTimer.setMaximumSize(new java.awt.Dimension(117, 23));
        btnReadTimer.setMinimumSize(new java.awt.Dimension(117, 23));
        btnReadTimer.setName("btnReadTimer"); // NOI18N
        btnReadTimer.setPreferredSize(new java.awt.Dimension(117, 23));

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addGroup(jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(btnReadTimer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnWriteTimer, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btnDeleteTimer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnSetDateTime, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addComponent(btnReadTimer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnWriteTimer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnDeleteTimer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnSetDateTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(11, 11, 11))
        );

        jPanel6.setName("jPanel6"); // NOI18N

        jLabel10.setText("On/Off");
        jLabel10.setName("jLabel10"); // NOI18N

        jScrollPane4.setFont(new java.awt.Font("SansSerif", 0, 11)); // NOI18N
        jScrollPane4.setName("jScrollPane4"); // NOI18N

        timer_weekday.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        timer_weekday.setName("timer_weekday"); // NOI18N
        jScrollPane4.setViewportView(timer_weekday);

        jLabel8.setText("Weekday");
        jLabel8.setName("jLabel8"); // NOI18N

        jScrollPane2.setName("jScrollPane2"); // NOI18N

        timer_poweronoff.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "On", "On", "On", "On", "On", "On", "On" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        timer_poweronoff.setName("timer_poweronoff"); // NOI18N
        jScrollPane2.setViewportView(timer_poweronoff);

        jLabel9.setText("Relais");
        jLabel9.setName("jLabel9"); // NOI18N

        jScrollPane3.setName("jScrollPane3"); // NOI18N

        timer_relais.setModel(new javax.swing.AbstractListModel() {
            String[] strings = { "Rel 1", "Rel 2", "Rel 3", "Rel 4", "Rel 5", "Rel 6", "Rel Aux" };
            public int getSize() { return strings.length; }
            public Object getElementAt(int i) { return strings[i]; }
        });
        timer_relais.setName("timer_relais"); // NOI18N
        jScrollPane3.setViewportView(timer_relais);

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addComponent(jLabel8)
                        .addGap(8, 8, 8))
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addComponent(jScrollPane4, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)))
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel9)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 46, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jScrollPane2)
                    .addComponent(jLabel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel8)
                    .addComponent(jLabel9)
                    .addComponent(jLabel10))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jScrollPane4, 0, 0, Short.MAX_VALUE)
                    .addComponent(jScrollPane2, 0, 0, Short.MAX_VALUE)))
        );

        jPanel4.setName("jPanel4"); // NOI18N

        timer_nr.setModel(new DefaultComboBoxModel());
        timer_nr.setName("timer_nr"); // NOI18N

        timer_day.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "XXXX", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31" }));
        timer_day.setName("timer_day"); // NOI18N

        jLabel6.setText("Date:");
        jLabel6.setName("jLabel6"); // NOI18N

        jLabel5.setText("Nr.");
        jLabel5.setName("jLabel5"); // NOI18N

        timer_minute.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "XXXX", "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23", "24", "25", "26", "27", "28", "29", "30", "31", "32", "33", "34", "35", "36", "37", "38", "39", "40", "41", "42", "43", "44", "45", "46", "47", "48", "49", "50", "51", "52", "53", "54", "55", "56", "57", "58", "59" }));
        timer_minute.setName("timer_minute"); // NOI18N

        timer_month.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "XXXX", "Jan", "Feb", "Mar", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }));
        timer_month.setName("timer_month"); // NOI18N

        jLabel7.setText("Time:");
        jLabel7.setName("jLabel7"); // NOI18N

        timer_hour.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "XXXX", "00", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20", "21", "22", "23" }));
        timer_hour.setName("timer_hour"); // NOI18N

        timer_second.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "00", "05", "10", "15", "20", "25", "30", "35", "40", "45", "50", "55" }));
        timer_second.setName("timer_second"); // NOI18N

        timer_year.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "XXXX", "2008", "2009", "2010", "2011", "2012", "2013", "2014", "2015" }));
        timer_year.setName("timer_year"); // NOI18N

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addComponent(jLabel7)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(timer_hour, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(timer_minute, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(timer_second, 0, 50, Short.MAX_VALUE))
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel6)
                    .addComponent(jLabel5))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(timer_nr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel4Layout.createSequentialGroup()
                        .addComponent(timer_day, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(timer_month, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(timer_year, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(timer_nr, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel5))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel6)
                    .addComponent(timer_day, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(timer_month, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(timer_year, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel7)
                    .addComponent(timer_hour, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(timer_minute, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(timer_second, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

        timer_getDateTime.setText("Get Date/Time Action");
        timer_getDateTime.setName("timer_getDateTime"); // NOI18N

        jLabel4.setText("Timed Events");
        jLabel4.setName("jLabel4"); // NOI18N

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup()
                        .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(18, 18, 18)
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(timer_getDateTime)
                            .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jLabel4))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(jPanel8Layout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel8Layout.createSequentialGroup()
                                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(timer_getDateTime))
                            .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel2.setName("jPanel2"); // NOI18N

        btnRelais1.setFont(new java.awt.Font("Tahoma", 1, 11));
        btnRelais1.setText("Relais 1");
        btnRelais1.setEnabled(false);
        btnRelais1.setMaximumSize(new java.awt.Dimension(100, 23));
        btnRelais1.setMinimumSize(new java.awt.Dimension(100, 23));
        btnRelais1.setName("btnRelais1"); // NOI18N
        btnRelais1.setPreferredSize(new java.awt.Dimension(100, 23));

        btnRelais2.setFont(new java.awt.Font("Tahoma", 1, 11));
        btnRelais2.setText("Relais 2");
        btnRelais2.setEnabled(false);
        btnRelais2.setMaximumSize(new java.awt.Dimension(100, 23));
        btnRelais2.setMinimumSize(new java.awt.Dimension(100, 23));
        btnRelais2.setName("btnRelais2"); // NOI18N
        btnRelais2.setPreferredSize(new java.awt.Dimension(100, 23));

        btnRelais3.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        btnRelais3.setText("Relais 3");
        btnRelais3.setEnabled(false);
        btnRelais3.setMaximumSize(new java.awt.Dimension(100, 23));
        btnRelais3.setMinimumSize(new java.awt.Dimension(100, 23));
        btnRelais3.setName("btnRelais3"); // NOI18N
        btnRelais3.setPreferredSize(new java.awt.Dimension(100, 23));

        btnRelaisAux.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        btnRelaisAux.setText("Relais Aux");
        btnRelaisAux.setEnabled(false);
        btnRelaisAux.setMaximumSize(new java.awt.Dimension(100, 23));
        btnRelaisAux.setMinimumSize(new java.awt.Dimension(100, 23));
        btnRelaisAux.setName("btnRelaisAux"); // NOI18N
        btnRelaisAux.setPreferredSize(new java.awt.Dimension(100, 23));

        btnReadRelais.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        btnReadRelais.setText("Read Relais");
        btnReadRelais.setMaximumSize(new java.awt.Dimension(100, 23));
        btnReadRelais.setMinimumSize(new java.awt.Dimension(100, 23));
        btnReadRelais.setName("btnReadRelais"); // NOI18N
        btnReadRelais.setPreferredSize(new java.awt.Dimension(100, 23));

        jLabel3.setText("Relais Switches");
        jLabel3.setName("jLabel3"); // NOI18N

        btnRelais5.setFont(new java.awt.Font("Tahoma", 1, 11));
        btnRelais5.setText("Relais 5");
        btnRelais5.setEnabled(false);
        btnRelais5.setMaximumSize(new java.awt.Dimension(100, 23));
        btnRelais5.setMinimumSize(new java.awt.Dimension(100, 23));
        btnRelais5.setName("btnRelais5"); // NOI18N
        btnRelais5.setPreferredSize(new java.awt.Dimension(100, 23));

        btnRelais6.setFont(new java.awt.Font("Tahoma", 1, 11));
        btnRelais6.setText("Relais 6");
        btnRelais6.setEnabled(false);
        btnRelais6.setMaximumSize(new java.awt.Dimension(100, 23));
        btnRelais6.setMinimumSize(new java.awt.Dimension(100, 23));
        btnRelais6.setName("btnRelais6"); // NOI18N
        btnRelais6.setPreferredSize(new java.awt.Dimension(100, 23));

        btnRelais4.setFont(new java.awt.Font("Tahoma", 1, 11));
        btnRelais4.setText("Relais 4");
        btnRelais4.setEnabled(false);
        btnRelais4.setMaximumSize(new java.awt.Dimension(100, 23));
        btnRelais4.setMinimumSize(new java.awt.Dimension(100, 23));
        btnRelais4.setName("btnRelais4"); // NOI18N
        btnRelais4.setPreferredSize(new java.awt.Dimension(100, 23));

        autoUpdate.setText("Auto-Update Status");
        autoUpdate.setName("autoUpdate"); // NOI18N

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(btnRelaisAux, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnRelais6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(10, 10, 10)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(btnRelais2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnRelais5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(10, 10, 10)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(btnRelais4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnRelais1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jLabel3))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(autoUpdate)
                    .addComponent(btnReadRelais, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnRelais3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(45, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel3)
                    .addComponent(autoUpdate))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(btnRelais2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnRelaisAux, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnRelais1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(btnRelais6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnRelais5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(btnRelais4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(btnReadRelais, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnRelais3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(2, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup()
                            .addContainerGap()
                            .addComponent(jLabel1))
                        .addComponent(jPanel8, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGap(12, 12, 12)
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, 79, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        getContentPane().add(jPanel1);
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JCheckBox autoUpdate;
    private javax.swing.JButton btnDeleteTimer;
    private javax.swing.JButton btnReadRelais;
    private javax.swing.JButton btnReadTimer;
    private javax.swing.JButton btnRelais1;
    private javax.swing.JButton btnRelais2;
    private javax.swing.JButton btnRelais3;
    private javax.swing.JButton btnRelais4;
    private javax.swing.JButton btnRelais5;
    private javax.swing.JButton btnRelais6;
    private javax.swing.JButton btnRelaisAux;
    private javax.swing.JButton btnSetDateTime;
    private javax.swing.JButton btnUpdateSettings;
    private javax.swing.JButton btnWriteTimer;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JLabel labelIP;
    private javax.swing.JLabel labelPort;
    private javax.swing.JTextArea statusMessages;
    private javax.swing.JComboBox timer_day;
    private javax.swing.JCheckBox timer_getDateTime;
    private javax.swing.JComboBox timer_hour;
    private javax.swing.JComboBox timer_minute;
    private javax.swing.JComboBox timer_month;
    private javax.swing.JComboBox timer_nr;
    private javax.swing.JList timer_poweronoff;
    private javax.swing.JList timer_relais;
    private javax.swing.JComboBox timer_second;
    private javax.swing.JList timer_weekday;
    private javax.swing.JComboBox timer_year;
    private javax.swing.JTextField txtIP;
    private javax.swing.JTextField txtPort;
    // End of variables declaration//GEN-END:variables
    public static Color RELAIS_ON_COLOR = new Color(0, 204, 0);
    public static Color RELAIS_OFF_COLOR = new Color(204, 0, 0);
}
